<?php
global $references;
$references = array(

    "unitOfWork" => array(
        "class" => "Pageley_Mapper_Gateway",
        "constructor" => array(
            "gateway" => "#{gateway}"
        )
    ),

    "requestDispatcher" => array(
        "class" => "Pageley_Controller_Dispatcher_Http",
        "properties" => array(
            "application" => "#{application}",
            "filters" => array(
                "^Commerce/Authenticated/.*$" => "#{authenticationFilter}"
            ),
            "controllers" => array(
                "Commerce/ListCategories" => "#{controller.commerce.listCategories}",
                "Commerce/GetCategory" => "#{controller.commerce.getCategory}",
                "Commerce/ListMostRecentArticles" => "#{controller.commerce.listMostRecentArticles}",
                "Commerce/FindArticles" => "#{controller.commerce.findArticles}",
                "Commerce/AddItemToOrder" => "#{controller.commerce.addItemToOrder}",
                "Commerce/RemoveItemsFromOrder" => "#{controller.commerce.removeItemsFromOrder}",
                "Commerce/UpdateOrderQuantities" => "#{controller.commerce.updateOrderQuantities}",
                "Commerce/Authenticated/PlaceOrder" => "#{controller.commerce.placeOrder}",
                "Commerce/Authenticated/CheckOut" => "#{controller.commerce.checkOut}",
                "Commerce/Authenticated/AddInfoToOrder" => "#{controller.commerce.addInfoToOrder}",
                "Commerce/Authenticated/CancelOrder" => "#{controller.commerce.cancelOrder}",
                "Commerce/LogInCustomer" => "#{controller.commerce.logInCustomer}",
                "Commerce/LogOutCustomer" => "#{controller.commerce.logOutCustomer}",
                "Commerce/RegisterCustomer" => "#{controller.commerce.registerCustomer}",
                "Commerce/ShowOrder" => "#{controller.commerce.showOrder}",
                "Commerce/StartRegisterCustomer" => "#{controller.commerce.startRegisterCustomer}",
                //"Commerce/Authenticated/ListCustomerOrders" => "#{controller.commerce.listCustomerOrders}",
                "Query" => "#{controller.query}",
                "Find" => "#{controller.find}",
                "Delete" => "#{controller.delete}",
                "Save" => "#{controller.save}",
                "Include" => "#{controller.include}"
            )
        )
    ),
    
    "authenticationFilter" => array(
        "class" => "Pageley_Commerce_AuthenticationFilter"
    ),
    
    "dictionary" => array(
        "class" => "Pageley_I18n_BasicDictionary",
        "constructor" => array(
            "localeMap" => array(
                "nl" => array(
                    "home" => "#{page.homeNl}",
                    "common" => "#{page.commonNl}",
                    "articles" => "#{page.articlesNl}",
                    "catalog" => "#{page.catalogNl}",
                    "order" => "#{page.orderNl}",
                    "message" => "#{page.messageNl}",
                    "error" => "#{page.errorNl}",
                    "field" => "#{page.fieldNl}",
                    "register" => "#{page.registerNl}",
                    "login" => "#{page.loginNl}"
                )
            ),
            "defaultLocale" => "nl"
        )
    ),

    "controller.commerce.listCategories" => array(
        "class" => "Pageley_Controller_TransactionalForm",
        "constructor" => array(
            "views" => array(
                "success" => "catalog"
            ),
            "commandClassName" => "Pageley_Commerce_Command_ListCategories",
            "unitOfWork" => "#{unitOfWork}"
        )
    ),

    "controller.commerce.getCategory" => array(
        "class" => "Pageley_Controller_TransactionalForm",
        "constructor" => array(
            "views" => array(
                "success" => "catalog"
            ),
            "commandClassName" => "Pageley_Commerce_Command_GetCategory",
            "unitOfWork" => "#{unitOfWork}"
        )
    ),

    "controller.commerce.listMostRecentArticles" => array(
        "class" => "Pageley_Controller_TransactionalForm",
        "constructor" => array(
            "views" => array(
                "success" => "articles/list"
            ),
            "commandClassName" => "Pageley_Commerce_Command_ListMostRecentArticles",
            "unitOfWork" => "#{unitOfWork}"
        )
    ),

    "controller.commerce.findArticles" => array(
        "class" => "Pageley_Controller_TransactionalForm",
        "constructor" => array(
            "views" => array(
                "success" => "catalog"
            ),
            "commandClassName" => "Pageley_Commerce_Command_FindArticles",
            "unitOfWork" => "#{unitOfWork}"
        )
    ),

    "controller.commerce.addItemToOrder" => array(
        "class" => "Pageley_Controller_TransactionalForm",
        "constructor" => array(
            "views" => array(
                "success" => "order",
                "failure" => "order"
            ),
            "commandClassName" => "Pageley_Commerce_Command_AddItemToOrder",
            "unitOfWork" => "#{unitOfWork}"
        )
    ),

    "controller.commerce.removeItemsFromOrder" => array(
        "class" => "Pageley_Controller_TransactionalForm",
        "constructor" => array(
            "views" => array(
                "success" => "order"
            ),
            "commandClassName" => "Pageley_Commerce_Command_RemoveItemsFromOrder",
            "unitOfWork" => "#{unitOfWork}"
        )
    ),

    "controller.commerce.updateOrderQuantities" => array(
        "class" => "Pageley_Controller_TransactionalForm",
        "constructor" => array(
            "views" => array(
                "success" => "order",
                "failure" => "order"
            ),
            "commandClassName" => "Pageley_Commerce_Command_UpdateOrderQuantities",
            "unitOfWork" => "#{unitOfWork}"
        )
    ),

    "controller.commerce.addInfoToOrder" => array(
        "class" => "Pageley_Controller_Dynamic",
        "constructor" => array(
            "views" => array(
                "success" => "order/overview",
                "failure" => "order/add-info"
            ),
            "commandClassName" => "Pageley_Commerce_Command_AddInfoToOrder",
            "unitOfWork" => "#{unitOfWork}"
        )
    ),

    "controller.commerce.placeOrder" => array(
        "class" => "Pageley_Controller_TransactionalForm",
        "constructor" => array(
            "views" => array(
                "success" => "message"
            ),
            "commandClassName" => "Pageley_Commerce_Command_PlaceOrder",
            "unitOfWork" => "#{unitOfWork}"
        )
    ),

    "controller.commerce.cancelOrder" => array(
        "class" => "Pageley_Controller_TransactionalForm",
        "constructor" => array(
            "views" => array(
                "success" => "order/list"
            ),
            "commandClassName" => "Pageley_Commerce_Command_CancelOrder",
            "unitOfWork" => "#{unitOfWork}"
        )
    ),

    "controller.commerce.logInCustomer" => array(
        "class" => "Pageley_Controller_TransactionalForm",
        "constructor" => array(
            "views" => array(
                "success" => "forward",
                "failure" => "login"
            ),
            "commandClassName" => "Pageley_Commerce_Command_LogInCustomer",
            "unitOfWork" => "#{unitOfWork}"
        )
    ),

    "controller.commerce.logOutCustomer" => array(
        "class" => "Pageley_Controller_Form",
        "constructor" => array(
            "views" => array(
                "success" => "forward"
            ),
            "commandClassName" => "Pageley_Commerce_Command_LogOutCustomer"
        )
    ),

    "controller.commerce.registerCustomer" => array(
        "class" => "Pageley_Controller_Dynamic",
        "constructor" => array(
            "views" => array(
                "success" => "message",
                "failure" => "register"
            ),
            "commandClassName" => "Pageley_Commerce_Command_RegisterCustomer",
            "unitOfWork" => "#{unitOfWork}"
        )
    ),

    "controller.commerce.showOrder" => array(
        "class" => "Pageley_Controller_Basic",
        "constructor" => array(
            "views" => array(
                "success" => "order"
            )
        )
    ),

    "controller.commerce.startRegisterCustomer" => array(
        "class" => "Pageley_Controller_Basic",
        "constructor" => array(
            "views" => array(
                "success" => "register"
            )
        )
    ),

    "controller.commerce.checkOut" => array(
        "class" => "Pageley_Controller_Form",
        "constructor" => array(
            "views" => array(
                "success" => "order/add-info"
            ),
            "commandClassName" => "Pageley_Commerce_Command_CheckOut"
        )
    ),

    "controller.commerce.listCustomerOrders" => array(
        "class" => "Pageley_Commerce_Command_ListCustomerOrders",
        "constructor" => array(
            "views" => array(
                "success" => "orders"
            )
        )
    )

);